home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Interactive Media Design Review 1999
/
Interactive Media Design Review 1999.iso
/
pc
/
Demos
/
Bombardier_PC
/
DATACH.CST
/
00350_Script_350
< prev
next >
Wrap
Text File
|
1999-03-07
|
8KB
|
262 lines
-- ****** Printing Routines *******
--
-- chris howell
--
global cpLineheight, cpTableCount, cpFontsize, cpFontname, cpLmargin
global cpTable1, cpTable2, cpTable3, cpTable4, cpTable5
global cpTable6, cpTable7, cpTable8, cpTable9, cpTable10
global cpCurrentLinePos
global cPRINTHANDLE
-- print the various data screen by calling interprint
on printAnnualOwnership
watchcursor()
interprint("Print_Ownership")
arrowcursor()
end
on printhourlybars
watchcursor()
interprint("Print_HourlyBars")
arrowcursor()
end
on printcostofownership
watchcursor()
interprint("Print_CostOwnership")
arrowcursor()
end
on printincomereturn
watchcursor()
interprint("Print_IncomeReturn")
arrowcursor()
end
on printflexjetpricing
watchcursor()
interprint("Print_flexjetpricing")
arrowcursor()
end
-- parse description page (stored as a castmember) and print the requested page
-- Description language is as follows:
-- _ - Underline as first character in document sets landscape mode
-- ~H (num) - sets the line height ie: ~H12
-- ~L (num) - sets the left margin
-- ~S (num) - sets the font size
-- ~F (name) - sets the font name ie:~FAriel
-- ~D (num), (num) ... - define table ie:~D0,100,150,210,400
-- ~T (data), (data), ... - Print data in table
-- (data) may start with a formating code as follows (in order parsed)
-- !N - normal type
-- !B - bold
-- !I - italic
-- !U - underline - types may be combined as in !BU
-- { - left justify
-- | - center text
-- } - right justify
-- @ - replace symbol with current plane name
-- ^ - replace symbol with current date
-- ?(castmembername) - replaces with text in castmembername
on interprint ipcastname
global mysystemcanprint
if mysystemcanprint then
initchprint
put the text of member ipcastname into printcommands
set linestoprint = the number of lines in printcommands
set cpCurrentLinePos = 0
if char 1 of printcommands = "_" then
setLandscapeMode(cPRINTHANDLE,True)
delete line 1 of printcommands
end if
newPage(cPRINTHANDLE)
repeat with pcount = 1 to linestoprint
set advanceflag = 0
set inputline = line pcount of printcommands
set prxmd = char 1 of inputline
if prxmd = "~" then
set prtodo = char 2 of inputline
delete char 1 to 2 of inputline
case (prtodo) of
"H":
set cpLineheight = value(inputline)
"L":
set cpLmargin = value(inputline)
"S":
set cpFontSize = value(inputline)
setTextSize(cPRINTHANDLE, cpFontSize)
"F":
set cpFontName = inputline
setTextFont(cPRINTHANDLE, cpFontName)
"D":
set cpTableCount = the number of items in inputline
if cpTableCount > 0 then set cpTable1 = value(item 1 of inputline)
if cpTableCount > 1 then set cpTable2 = value(item 2 of inputline)
if cpTableCount > 2 then set cpTable3 = value(item 3 of inputline)
if cpTableCount > 3 then set cpTable4 = value(item 4 of inputline)
if cpTableCount > 4 then set cpTable5 = value(item 5 of inputline)
if cpTableCount > 5 then set cpTable6 = value(item 6 of inputline)
if cpTableCount > 6 then set cpTable7 = value(item 7 of inputline)
if cpTableCount > 7 then set cpTable8 = value(item 8 of inputline)
if cpTableCount > 8 then set cpTable9 = value(item 9 of inputline)
"T":
set tempcol = the number of items in inputline
if tempcol > 0 then cpPrint(cpTable1, item 1 of inputline)
if tempcol > 1 then cpPrint(cpTable2, item 2 of inputline)
if tempcol > 2 then cpPrint(cpTable3, item 3 of inputline)
if tempcol > 3 then cpPrint(cpTable4, item 4 of inputline)
if tempcol > 4 then cpPrint(cpTable5, item 5 of inputline)
if tempcol > 5 then cpPrint(cpTable6, item 6 of inputline)
if tempcol > 6 then cpPrint(cpTable7, item 7 of inputline)
if tempcol > 7 then cpPrint(cpTable8, item 8 of inputline)
if tempcol > 8 then cpPrint(cpTable9, item 9 of inputline)
set advanceflag = 1
end case
else
cpPrint(cpLmargin, inputline)
set advanceflag = 1
end if
if advanceflag = 1 then
-- move down 1 line
set cpCurrentLinePos = cpCurrentLinePos + cpLineheight
end if
end repeat
-- print page
if doJobSetup(cPRINTHANDLE) then print cPRINTHANDLE
set cPRINTHANDLE = 0
end if
end
on initchprint
register(xtra "PrintOMatic", "POMX153-038-05853")
set cPRINTHANDLE = new(xtra "PrintOMatic")
if not objectP(cPRINTHANDLE) then
alert("no printer")
end if
end
on cpPrint itextpos, itext
global CurrentPlane
-- parse style
if char 1 of itext = " " then
delete char 1 of itext
end if
if char 1 of itext = "!" then
delete char 1 of itext
if char 1 of itext = "N" then
delete char 1 of itext
setTextStyle (cPRINTHANDLE, "normal")
end if
if char 1 of itext = "B" then
delete char 1 of itext
setTextStyle (cPRINTHANDLE, "bold")
end if
if char 1 of itext = "I" then
delete char 1 of itext
setTextStyle (cPRINTHANDLE, "italic")
end if
if char 1 of itext = "U" then
delete char 1 of itext
setTextStyle (cPRINTHANDLE, "underline")
end if
end if
if char 1 of itext = "{" then
delete char 1 of itext
setTextJust(cPRINTHANDLE,"left")
end if
if char 1 of itext = "}" then
delete char 1 of itext
setTextJust(cPRINTHANDLE,"right")
end if
if char 1 of itext = "|" then
delete char 1 of itext
setTextJust(cPRINTHANDLE,"center")
end if
set outstring = itext
if char 1 of itext = "@" then
set outstring = CurrentPlane
end if
if char 1 of itext = "^" then
set outstring = the date
end if
if char 1 of itext = "?" then
delete char 1 of itext
set outstring = the text of member itext
end if
-- print test at position itextpos
drawText(cPRINTHANDLE, outstring, Point(itextpos,cpCurrentLinePos))
end
---- formatting (same as bjs)
on formatch numbertoformat
if integerP(numbertoformat) or floatp(numbertoformat) then
set the floatPrecision = 4
set numtoconv = 1.0000 * numbertoformat
-- put numtoconv & "-is the numtoconv"
if numtoconv > 1000 then
set eout = format(1.0 * integer(numtoconv))
else
set eout = format(numtoconv)
end if
-- put "formatting" && numbertoformat && eout
return eout
else
return numbertoformat
end if
end
on formatch2 numbertoformat
if integerP(numbertoformat) or floatp(numbertoformat) then
set the floatPrecision = 2
set numtoconv = 1.0000 * numbertoformat
-- put numtoconv & "-is the numtoconv"
if numtoconv > 1000 then
set eout = format(1.0 * integer(numtoconv))
else
set eout = format(numtoconv)
end if
-- put "formatting" && numbertoformat && eout
return eout
else
return numbertoformat
end if
end
---format
on format figure
set figure=""&figure
set len=length(figure)
--assuming that we have 4 digits after rhe point
if figure contains "." then set len=len-5
set fmoney =""
set ii=0
repeat with i=0 to len
set ii=ii+1
if ii=4 and len-i > 0 then
set fmoney = ","&fmoney
set fmoney = chars(figure,len-i,len-i)&fmoney
set ii=1
else
set fmoney = chars(figure,len-i,len-i)&fmoney
end if
end repeat
set len=length(figure)
if chars(figure,len-4,len)<>".0000" then
set fmoney=fmoney&chars(figure,len-4,len-2)
end if
--
set figure=fmoney
return(figure)
end
---format $ sign